import processor
import inventorysupport, roomsupport, doorsupport, examine, dump, failed

roomsupport.InvalidRoomError.text = "You hit your head on the wall."

processor.me.maxweight = 15
o = processor.Object( ("red sleeping bag", "sleeping bag") )
o.weight = 8
processor.me.acquire(o)

r = roomsupport.Room("Living Room", "The living room is musty, with cobwebs hanging from the ceiling. The walls are an off-green.")
o = processor.Object( ("moldy chocolate cookie", "chocolate cookie", "cookie") )
o.weight = 5
o.desc = "The cookie, long green from the mold, almost looks tasty. The fact that you didn't eat lunch may be responsible."
r.acquire(o)
r.acquire(processor.Object( ("floor"), ("the", "the") ))
o = processor.Object( ("basketball", "ball") )
o.weight = 10
o.desc = "The basketball, deflated from age, looks a little like your aunt in her final years."
r.acquire(o)
roomsupport.rooms.append(r)

r = roomsupport.Room("Kitchen", "The cramped kitchen is decorated in typical 50's style. The dust covering the counters gives you the urge to clean.")
tmp =  roomsupport.getRoom("Living Room")
r.setTwoWay("south", tmp, doorsupport.Door(False, r, tmp, ("kitchen door", "door") ));
o = processor.Object( ("old bent spoon", "spoon", "silverwear") )
o.weight = 5
o.desc = "Uri Geller was here."
r.acquire(o)
o = processor.Object( ("refridgerator", "fridge") )
o.weight = 50
o.desc = "The refridgerator looks like a death trap. Its contents are slowly dripping through the door seal. you decide to stay away."
r.acquire(o)
roomsupport.rooms.append(r)

r = roomsupport.Room("Outside", "Nobody should see this.")
tmp = roomsupport.getRoom("Living Room")
tmp.setOneWay("east", r, doorsupport.StuckDoor("You have no desire to abandon your inheritence. Besides, it's raining!", False, r, tmp, ("front door", "door")))

r = roomsupport.Room("Dining Room", "The dining is empty.")
tmp = roomsupport.getRoom("Living Room")
door = doorsupport.LockedDoor(True, False, r, tmp, ("dining room door", "door"))
tmp.setTwoWay("west", r, door)
o = door.createKey(["small silver key", "key"])
o.weight = 2
processor.me.acquire(o)



processor.me.setRoom(roomsupport.getRoom("Living Room"))

#description
class StartingDescription(object):
    def hook(self, hooktype, command, ret):
        if hooktype == processor.STARTUP_CALL:
            return "The house was left to you by your great-aunt Gertrude, who must have hated you. It dated to 1875 and hadn't had any maintenance since. The will stated you must sleep in the house for one week to claim her money, so here you are. It was a dark and stormy night, of course. You muttered under your breath about your beloved relative as you carried your sleeping bag into the living room.\n"
processor.hooks.insert(0, StartingDescription())

#silly ambient effect
class Ambient(object):
    def __init__(self): self.step = 0
    def hook(self, hooktype, command, ret):
        if hooktype == processor.POSTPROCESS_CALL:
            self.step = (self.step + 1) % 12
            if self.step == 3:
                return "The floor creaks beneath you."
            elif self.step == 10:
                return "An owl hoots outside."
processor.hooks.append(Ambient())

